﻿
<?php 

    include 'loginYanZheng.php';

    weiDengLu();


?>
<!DOCTYPE html>
<html lang="ch">
<head>
	<meta charset="utf8">
	<title>DOM取值</title>
	<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css">
    <style type="text/css">

    </style>
</head>
<body>

	<div class="layui-container">

		<div class="layui-row">
			<div class="layui-col-md2">
	              
	              <a href="jiemian.php"><i class="layui-icon layui-icon-left" style="font-size:20px"></i><div class="doc-icon-name">返回</div></a>

	      </div>
		</div>
		<hr>
		<div class="layui-row">

			<div class="layui-col-md6">
				<button type="button" class="layui-btn">提交</button> 
				<button type="button" class="layui-btn">清空</button>
			</div>
			<div class="layui-col-md6">
				<div id="len">
					
				</div>
			</div>
			
		</div>

		<div class="layui-row layui-col-space10">
			
			<div class="layui-col-md6">

				<textarea style="width:100%;height: 500px;">
					
				</textarea>
			</div>

			<div class="layui-col-md6">
				
				<textarea style="width:100%;height: 500px;">
					
				</textarea>
				
			</div>

		</div>


		<div id="con" class="layui-row">
			
		</div>


		
	</div>
	<script type="text/javascript" src="layui/layui.all.js"></script>
	<script type="text/javascript">
			


			$('button:first').click(function(){


				var tellHtml=''

				var text=$('textarea:first').val()

				var len=0;
				
				var rowLen=0

				$('#con').html('')

				$('#con').html(text)

				$('.o_data_row').each(function(index){


					if(this.cells[11].innerText!=='没有记录'){

						var tell=this.cells[9].innerText

						tellHtml+=tell+'\n';

						len++;
					}

					rowLen++;
				})

				$('#len').html('<span>'+rowLen+'</span>条数据中<span>'+len+'</span>个意向客户&nbsp&nbsp<button  onclick="upDate()" class="layui-btn">上传数据</button>')

				$('span').css('font-weight','bold')

				$('#con').html('')
				
				$('textarea:last').val('')
				
				$('textarea:last').val(tellHtml)

			
			})

			$('button:last').click(function(){
				$('textarea').val('')
			})


			function upDate(){

				var yetell=$('textarea:last').val()

				if(yetell!==''){

					var yt={'tell':yetell.match(/\d{11}/g,",")};

					var ytJson=JSON.stringify(yt)

					// var ytJson=yetell.replace(/\n/g,"','")

					// ytJson="'"+ytJson.substring(0,ytJson.length-2)

					console.log(ytJson)

					$.post(

						'mingxi.php',
						{xyTell:ytJson,type:37},
						function(data){

							console.log(data)
							var layer=layui.layer;
							layer.alert(data)
						}
				)




				}




			}



		

	</script>

</body>
</html>